import request from "@/utils/request";

export function sendMobileCode(mobile,type){
  return request({
    url: `/login/${type}/getMobileCode`,
    method: 'get',
    params:{
      mobile
    },
    handleError: true,
  })
}


export function sendEmailCode(email,type){
  return request({
    url: `/login/${type}/getEmailCode`,
    method: 'get',
    params:{
      email
    },
    handleError: true,
  })
}


/**
 * 获取登录的token
 * @param key
 * @returns {Promise | Promise<unknown>}
 */
export function getUserLoginToken(key){
  return request({
    url: `/login/getUserLoginToken/${key}`,
    method: 'get',
    handleError: true,
  })
}

/**
 * 演示登录
 * @param key
 * @returns {Promise<unknown>}
 */
export function getBackLoginToken(key){
  return request({
    url: `/common/getBackLoginToken/${key}`,
    method: 'get',
    handleError: true,
  })
}
